package biblioteque;

import java.io.Serializable;
import java.util.HashMap;

public class Mot implements Serializable{

	/**
	 * Nombre de document contenant le mot il s'agit donc DF(t)
	 */
	private int nbDocuments;
	/**
	 * Reference vers les documents contenant ce mot
	 * type HashMap<idDuDocument, InfoDocument>
	 */
	private HashMap<Integer, InfoDocument> documents;
	
	private String id;
	
	
	/**
	 * ca permet de savoir le dernier document compte qui contient ce mot
	 */
	private int lastedtDoc;
	
	public Mot(String id,int numDoc)
	{
		this.id=id;
		this.lastedtDoc = numDoc;
		nbDocuments = 1;
		documents = new HashMap<Integer, InfoDocument>();
	}
	
	public int getNbDocuments() {
		return nbDocuments;
	}
	public void setNbDocuments(int nbDocuments) {
		this.nbDocuments = nbDocuments;
	}
	public HashMap<Integer, InfoDocument> getDocuments() {
		return documents;
	}
	public void setDocuments(HashMap<Integer, InfoDocument> documents) {
		this.documents = documents;
	}
	
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public int getLastestDoc() {
		return lastedtDoc;
	}

	public void setLastestDoc(int lastedtDoc) {
		this.lastedtDoc = lastedtDoc;
	}

	public void incrementNbDocuments(int numDoc){
		
		if(this.lastedtDoc != numDoc)
		{
			this.nbDocuments++;
			this.lastedtDoc = numDoc;
		}
	}
	

	@Override
	public String toString() {
		return "Mot [nbDocuments=" + nbDocuments + ", documents=" + documents
				+ ", id=" + id + ", lastestDoc=" + lastedtDoc + "]";
	} 
}
